package com.jspgou.cms.manager.impl;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jspgou.cms.dao.OrderDao;
import com.jspgou.cms.entity.Cart;
import com.jspgou.cms.entity.CartItem;
import com.jspgou.cms.entity.MemberCoupon;
import com.jspgou.cms.entity.Order;
import com.jspgou.cms.entity.OrderItem;
import com.jspgou.cms.entity.OrderReturn;
import com.jspgou.cms.entity.Payment;
import com.jspgou.cms.entity.Product;
import com.jspgou.cms.entity.ProductFashion;
import com.jspgou.cms.entity.Shipping;
import com.jspgou.cms.entity.ShopMember;
import com.jspgou.cms.entity.ShopMemberAddress;
import com.jspgou.cms.entity.ShopPaymentorder;
import com.jspgou.cms.entity.ShopScore;
import com.jspgou.cms.entity.Store;
import com.jspgou.cms.entity.ShopScore.ScoreTypes;
import com.jspgou.cms.manager.CartItemMng;
import com.jspgou.cms.manager.CartMng;
import com.jspgou.cms.manager.DiscussMng;
import com.jspgou.cms.manager.MemberCouponMng;
import com.jspgou.cms.manager.OrderMng;
import com.jspgou.cms.manager.OrderReturnMng;
import com.jspgou.cms.manager.ProductFashionMng;
import com.jspgou.cms.manager.ProductMng;
import com.jspgou.cms.manager.ShipmentsMng;
import com.jspgou.cms.manager.ShippingMng;
import com.jspgou.cms.manager.ShopMemberMng;
import com.jspgou.cms.manager.ShopPaymentorderMng;
import com.jspgou.cms.manager.ShopScoreMng;
import com.jspgou.cms.manager.StoreMng;
import com.jspgou.common.hibernate3.Updater;
import com.jspgou.common.page.Pagination;
import com.jspgou.core.entity.Website;
import com.jspgou.core.manager.WebsiteMng;

@Service
@Transactional
public class OrderMngImpl implements OrderMng {
	
	@Transactional(readOnly = true)
	public Pagination getPage(int pageNo, int pageSize) {
		Pagination page = dao.getPage(pageNo, pageSize);
		return page;
	}
	
	// 生成订单
	public ShopPaymentorder createOrders(Long deliveryMethodSelector[],
			String ip, String comments, Cart cart, Long[] cartItemId,
			ShopMemberAddress address, Payment pay, ShopMember member,
			Long webId,String memberCouponId) {
		Website web = websiteMng.findById(webId);
		List<CartItem> itemList = new ArrayList<CartItem>();
		for (Long cId : cartItemId) {
			itemList.add(cartItemMng.findById(cId));
		}
		List<Store> list = getStorebyCartItem(itemList);
		Order order = null;
		Double paymentorderTotal = 0.0;
		Double freight=0.0;
		Double  couponPrice=0.00;
		Long mcId = null;
		if (!StringUtils.isBlank(memberCouponId)){
			mcId = Long.parseLong(memberCouponId);
		}
		if(mcId!=null){
			MemberCoupon memberCoupon = memberCouponMng.findById(mcId);
			if(memberCoupon!=null){
				if(!memberCoupon.getIsuse()){
					couponPrice = memberCoupon.getCoupon().getCouponPrice().doubleValue();
					memberCoupon.setIsuse(true);
					memberCouponMng.update(memberCoupon);
				}
			}
		}		
		ShopPaymentorder shopPaymentorder = new ShopPaymentorder();
		
		if (getStoreBycartItems(itemList, null).size() > 0) {
			//平台上商品入口
			order = createOrder(null,cart, getStoreBycartItems(itemList, null),
					getShippingById(deliveryMethodSelector, null), ip,
					comments, address, pay, member, web,shopPaymentorder);
			//paymentorderTotal = paymentorderTotal + order.getTotal();
			paymentorderTotal = paymentorderTotal + order.getProductPrice();
			freight= freight+order.getFreight();    
		}

		for (Store s : list) {
			//第三方店铺商品入口
			order = createOrder(s.getId(),cart, getStoreBycartItems(itemList, s.getId()),
					getShippingById(deliveryMethodSelector, s.getId()), ip,
					comments, address, pay, member, web,shopPaymentorder);
			//paymentorderTotal = paymentorderTotal + order.getTotal();
			paymentorderTotal = paymentorderTotal + order.getProductPrice();
			freight=freight+order.getFreight();
		}
		Long Paymentorder = new Random().nextInt(999999999)+member.getId();
		shopPaymentorder.setCode(Paymentorder.toString());
		shopPaymentorder.setPaymentCode(pay.getName());
		shopPaymentorder.setId(order.getId());
		//等待支付
		shopPaymentorder.setStatus(1);
		shopPaymentorder.setTotal(paymentorderTotal-couponPrice);
		shopPaymentorder.setPayment(pay);
		shopPaymentorder.setProductName(order.getProductName());
		shopPaymentorder.setFreight(freight);
		shopPaymentorder.setReceiveName(order.getReceiveName());
		shopPaymentorder.setReceiveAddress(order.getReceiveAddress());
		shopPaymentorder.setReceivePhone(order.getReceivePhone());
		shopPaymentorder.setReceiveMobile(order.getReceiveMobile());
		shopPaymentorder.setReceiveZip(order.getReceiveZip());	
		shopPaymentorder = shopPaymentorderMng.save(shopPaymentorder);
		return shopPaymentorder;
	}
	
	// 生成订单
	public Order buyNowCreateOrder(Product product,Integer count,Long deliveryMethodSelector[], String ip,String comments,
			ShopMemberAddress address,Payment pay,ShopMember member, 
			Long webId,String memberCouponId) {
			Website web = websiteMng.findById(webId);
			
			Order order = null;
			Double paymentorderTotal = 0.0;
			Double freight=0.0;
			Double  couponPrice=0.00;
			Long mcId = null;
			if (!StringUtils.isBlank(memberCouponId)){
				mcId = Long.parseLong(memberCouponId);
			}
			if(mcId!=null){
				MemberCoupon memberCoupon = memberCouponMng.findById(mcId);
				if(memberCoupon!=null){
					if(!memberCoupon.getIsuse()){
						couponPrice = memberCoupon.getCoupon().getCouponPrice().doubleValue();
						memberCoupon.setIsuse(true);
						memberCouponMng.update(memberCoupon);
					}
				}
			}		
			if(product.getStore()!=null){
				order = buyNowCreateOrder(product.getStore().getId(),product, count, getShippingById(deliveryMethodSelector, product.getStore().getId()), ip, comments, address, pay, member, web);
			}else{
				order = buyNowCreateOrder(null,product, count, getShippingById(deliveryMethodSelector, null), ip, comments, address, pay, member, web);
			}
			
			freight= freight+order.getFreight();    
			paymentorderTotal = paymentorderTotal + order.getProductPrice();
			
			ShopPaymentorder shopPaymentorder = new ShopPaymentorder();
			Long Paymentorder = new Random().nextInt(999999999)+member.getId();
			shopPaymentorder.setCode(Paymentorder.toString());
			shopPaymentorder.setPaymentCode(pay.getName());
			shopPaymentorder.setId(order.getId());
			shopPaymentorder.setTotal(paymentorderTotal-couponPrice);
			shopPaymentorder.setPayment(pay);
			shopPaymentorder.setProductName(order.getProductName());
			shopPaymentorder.setFreight(freight);
			
			shopPaymentorder.setReceiveName(order.getReceiveName());
			shopPaymentorder.setReceiveAddress(order.getReceiveAddress());
			shopPaymentorder.setReceivePhone(order.getReceivePhone());
			shopPaymentorder.setReceiveMobile(order.getReceiveMobile());
			shopPaymentorder.setReceiveZip(order.getReceiveZip());
			
			
			shopPaymentorder = shopPaymentorderMng.save(shopPaymentorder);
			return order;
		}

	public Pagination getFcPage(Integer paymentStatus,Integer shippingStatus,Integer status,Long storeId,Long memberId,int pageNo, int pageSize){
		Pagination page = dao.getFcPage(paymentStatus,shippingStatus,status,storeId,memberId,pageNo, pageSize);
		return page;
	}
	
	public Order createOrder (Long storeId,Cart cart,List<CartItem> itemlist,
			Shipping shipping,String ip,String comments,
			ShopMemberAddress address,Payment pay,ShopMember member,
			Website web,ShopPaymentorder shopPaymentorder){
		Order order = new Order();
		int score = 0;
		double weight=0;
		double price=0.00;
		order.setShipping(shipping);
		if(storeId!=null){		
			Store store=storeMng.findById(storeId);
			order.setStore(store);
		}
		order.setIp(ip);
		order.setShopPaymentorder(shopPaymentorder);
		order.setPayment(pay);
		order.setWebsite(web);
		order.setMember(member);
		order.setComments(comments);
		order.setStatus(1);//未确认
		order.setShippingStatus(1);//未发货
		order.setPaymentStatus(1);//未支付
		order.setReceiveName(address.getUsername());
		order.setReceiveAddress(getAddress(address));
		order.setReceiveMobile(address.getTel());
		order.setReceivePhone(address.getMobile());
		order.setReceiveZip(address.getPostCode());
		order.setAfter(false);
		order.setDeliver(false);
		order.setRefunded(false);
		
		for (CartItem item : itemlist) {
			score = score + item.getProduct().getScore() * item.getCount();
			weight=weight+item.getProduct().getWeight()*item.getCount();
			if(item.getProductFash()!=null){
				if(item.getProduct().getPromote()!=null){
					price+=item.getProductFash().getSalePrice()*item.getProduct().getPromote().getDiscount().floatValue()*item.getCount();
				}else{
					price+=item.getProductFash().getSalePrice()*item.getCount();
				}
			}else{
				if(item.getProduct().getPromote()!=null){
					price+=item.getProduct().getSalePrice()*item.getProduct().getPromote().getDiscount().floatValue()*item.getCount();
				}else{
					price+=item.getProduct().getSalePrice()*item.getCount();
				}
			}
		}
		member.setFreezeScore(score+member.getFreezeScore());//会员冻结的积分
		order.setScore(score);
		order.setWeight((double)weight);
		order.setProductPrice(price);
	    double freight=shipping.calPrice((double)weight);
 	    order.setFreight(freight);
 		order.setTotal(freight+price);
		Long date=new Date().getTime()+member.getId();
		order.setCode(date.toString());
		CartItem cartItem=null;
		OrderItem orderItem=null;
		String productName="";
		for(int j=0;j<itemlist.size();j++){
			orderItem=new OrderItem();
			cartItem=(CartItem) itemlist.get(j);
			orderItem.setItemOrder(order);
			orderItem.setProduct(cartItem.getProduct());
			orderItem.setWebsite(web);
			orderItem.setCount(cartItem.getCount());
			if(cartItem.getProductFash()!=null){
				orderItem.setProductFash(cartItem.getProductFash());
				orderItem.setSalePrice(cartItem.getProductFash().getSalePrice());
			}else{
				orderItem.setSalePrice(cartItem.getProduct().getSalePrice());
			}
			order.addToItems(orderItem);
		}
		if(itemlist.size()>1){
			productName=itemlist.get(0).getProduct().getName()+" 等多件";
		}else{
			productName=itemlist.get(0).getProduct().getName();
		}
		order.setProductName(productName);
		if(cart!=null){
			cart.getItems().removeAll(itemlist);
			cartMng.update(cart);
		}
	
		order=save(order);
		for(OrderItem item:order.getItems()){
			saveShopScore(order,item,member);
		}
		return order;
	}
	

	public Order buyNowCreateOrder(Long storeId,Product product,Integer count,Shipping shipping,String ip,String comments,
			ShopMemberAddress address,Payment pay,ShopMember member,Website web){
		Order order = new Order();
		int score = 0;
		double weight=0;
		double price=0.00;
		order.setShipping(shipping);
		if(storeId!=null){		
			Store store=storeMng.findById(storeId);
			order.setStore(store);
		}
		order.setIp(ip);
		order.setPayment(pay);
		order.setWebsite(web);
		order.setMember(member);
		order.setComments(comments);
		order.setStatus(1);//未确认
		order.setShippingStatus(1);//未发货
		order.setPaymentStatus(1);//未支付
		order.setReceiveName(address.getUsername());
		order.setReceiveAddress(getAddress(address));
		order.setReceiveMobile(address.getTel());
		order.setReceivePhone(address.getMobile());
		order.setReceiveZip(address.getPostCode());
		order.setAfter(false);
		order.setDeliver(false);
		order.setRefunded(false);
			score = score + product.getScore() * count;
			weight=weight+product.getWeight()*count;
			if(product.getProductFashion()!=null){
				if(product.getPromote()!=null){
					price+=product.getProductFashion().getSalePrice()*product.getPromote().getDiscount().floatValue()*count;
				}else{
					price+=product.getProductFashion().getSalePrice()*count;
				}
			}else{
				if(product.getPromote()!=null){
					price+=product.getSalePrice()*product.getPromote().getDiscount().floatValue()*count;
				}else{
					price+=product.getSalePrice()*count;
				}
			}
		member.setFreezeScore(score+member.getFreezeScore());//会员冻结的积分
		order.setScore(score);
		order.setWeight((double)weight);
		order.setProductPrice(price);
		double freight=shipping.calPrice((double)weight);
		order.setFreight(freight);
		order.setTotal(freight+price);
		Long date=new Date().getTime()+member.getId();
		order.setCode(date.toString());
		OrderItem orderItem=null;
		String productName="";
			orderItem=new OrderItem();
			orderItem.setItemOrder(order);
			orderItem.setProduct(product);
			orderItem.setWebsite(web);
			orderItem.setCount(count);
			if(product.getProductFashion()!=null){
				orderItem.setProductFash(product.getProductFashion());
				orderItem.setSalePrice(product.getProductFashion().getSalePrice());
			}else{
				orderItem.setSalePrice(product.getSalePrice());
			}
			order.addToItems(orderItem);
		productName=product.getName();
		order.setProductName(productName);
		order=save(order);
		for(OrderItem item:order.getItems()){
			saveShopScore(order,item,member);
		}
		return order;
	}
	
	public void saveShopScore(Order order,OrderItem item,ShopMember member){
		ShopScore shopScore=null;
		Product product=null;
		ProductFashion fashion=null;
		product=item.getProduct();
		product.setStockCount(product.getStockCount()-item.getCount());
		if(item.getProductFash()!=null){
			fashion=item.getProductFash();
			fashion.setStockCount(fashion.getStockCount()-item.getCount());
			productFashionMng.update(fashion);
		}
		Updater<Product> updater = new Updater<Product>(product);
		productMng.updateByUpdater(updater);
		shopScore=new ShopScore();
		shopScore.setMember(member);
		shopScore.setOrder(order);
		shopScore.setOrderItem(item);
		shopScore.setName(item.getProduct().getName());
		shopScore.setScoreTime(new Date());
		shopScore.setStatus(false);
		shopScore.setUseStatus(false);
		shopScore.setScoreType(ScoreTypes.ORDER_SCORE.getValue());
		shopScore.setScore(item.getProduct().getScore()*item.getCount());
		shopScoreMng.save(shopScore);
	}

	public Shipping getShippingById(Long deliveryMethodSelector[],Long storeId){
		Shipping shipping = null;
		for(Long d:deliveryMethodSelector){
			if(storeId==null){
				if(shippingMng.findById(d).getStore()==null){
					shipping=shippingMng.findById(d);
				}
			}else{
				if(shippingMng.findById(d).getStore()!=null){
					if(shippingMng.findById(d).getStore().getId()==storeId){
						shipping=shippingMng.findById(d);
					}
				}
			}
		}
		return shipping;
	}

	public List<CartItem> getStoreBycartItems(List<CartItem> itemList,Long storeId){
		List<CartItem> cartitemlist = new ArrayList<CartItem>();
		for(CartItem item:itemList){
			if(storeId==null){
				if(item.getStore()==null){
					cartitemlist.add(item);
				}
			}else{
				if(item.getStore()!=null){
					if(item.getStore().getId()==storeId){
						cartitemlist.add(item);
					}
				}
			}
		}
		return cartitemlist;
	}
	
	public List<Store> getStorebyCartItem(List<CartItem> itemList){
		List<Store> list=new ArrayList<Store>();
		Set<Long> set=new HashSet<Long>();
		for(CartItem ci:itemList){
			if(ci.getStore()!=null){
				set.add(ci.getStore().getId());
			}  
		}
		for(Long id:set){
			list.add(storeMng.findById(id));
		}
		return list;
	}
	
	public String getAddress(ShopMemberAddress address){
		String str = "";
		if(address.getProvince()!=null){
			str = str + address.getProvince()+"-";
		}
		if(address.getCity()!=null){
			str = str + address.getCity()+"-";
		}
		if(address.getCountry()!=null){
			str = str + address.getCountry()+"-";
		}
		str = str+address.getDetailaddress();
		return str;
	}
	
	
	public Order updateByUpdater(Order bean) {
		Updater<Order> updater = new Updater<Order>(bean);
		return dao.updateByUpdater(updater);
	}
	
	public Pagination getOrderByReturn(Long memberId,int pageNo,int pageSize){
		return dao.getOrderByReturn(memberId, pageNo, pageSize);
	}
	
	@Transactional(readOnly = true)
	public Pagination getPage(Long webId, Long memberId,Long storeId,Integer status,Boolean isRefunded,String code,Long source,
			String productName,String userName, Long paymentId,Long shippingId,Integer paymentStatus,
			Integer shippingStatus,Long discuss,Date startTime,Date endTime,Double startOrderTotal,Double endOrderTotal,
			int pageNo, int pageSize) {
		Pagination page = dao.getPage(webId,memberId,storeId,status,isRefunded,code,source,productName,userName,
				paymentId,shippingId,paymentStatus,shippingStatus,discuss,startTime,endTime,startOrderTotal,endOrderTotal,
				pageNo, pageSize);
		return page;
	}
	
	public List<Order> getList(Long webId,Long memberId,Long storeId,
			Integer status,Integer paymentStatus, String productName,String userName,
			Long paymentId,Long shippingId, Date startTime,Date endTime,
			Double startOrderTotal,Double endOrderTotal){
		List<Order> list=dao.getList(webId, memberId, storeId, status, paymentStatus,
				productName, userName, paymentId, shippingId, startTime, 
				endTime, startOrderTotal, endOrderTotal);
		return list;
	}

//	@Transactional(readOnly = true)
//	public Pagination getPageForMember(Long memberId, int pageNo, int pageSize) {
//		return dao.getPageForMember(memberId, pageNo, pageSize);
//	}
//	
//	public Pagination getPageForMember1(Long memberId, int pageNo, int pageSize){
//		return dao.getPageForMember1(memberId, pageNo, pageSize);
//	}
//	
//	public Pagination getPageForMember2(Long memberId, int pageNo, int pageSize){
//		return dao.getPageForMember2(memberId, pageNo, pageSize);
//	}
//	public Pagination getPageForMember3(Long memberId, int pageNo, int pageSize) {
//		return dao.getPageForMember3(memberId, pageNo, pageSize);
//	}
	
	@Transactional(readOnly = true)
	public Order findById(Long id) {
		Order entity = dao.findById(id);
		return entity;
	}
	
	public Order findByCode(String code){
		Order entity=dao.findByCode(code);
		return entity;
	}
	
	public Order findByTradeNo(String tradeNo){
		Order entity = dao.findByTradeNo(tradeNo);
		return entity;
	}

	public Order save(Order bean) {
		bean.init();
		dao.save(bean);
		return bean;
	}

	public List<Object> getTotalOrder() {
		return dao.getTotalOrder();
	}
	
	public List<Object> getStoreTotalOrder(Long id){
		return dao.getStoreTotalOrder(id);
	}

	public BigDecimal getMemberMoneyByYear(Long memberId) {
		return dao.getMemberMoneyByYear(memberId);
	}
	
	public Order deleteById(Long id) {
		Order bean=dao.findById(id);
		shipmentMng.deleteByorderId(id);
		if(bean.getReturnOrder()!=null){
			System.out.println(bean.getReturnOrder());
			if(bean.getReturnOrder()!=null){				
				orderReturnMng.deleteById(bean.getReturnOrder().getId());
			}
		}
		//(未发货&&未确认)||(没有发货&&已确认))&&不是预售订单
		if(((bean.getShippingStatus()==1&&bean.getStatus()==1)||(bean.getShippingStatus()==1&&bean.getStatus()==2))&&bean.getRefunded()==false){
			//删除订单前，先删除订单对应积分明细项库存
			for(OrderItem item :bean.getItems()){
				Product product=item.getProduct();
				if(item.getProductFash()!=null){
					ProductFashion fashion=item.getProductFash();
					fashion.setStockCount(fashion.getStockCount()+item.getCount());
					product.setStockCount(product.getStockCount()+item.getCount());
					productFashionMng.update(fashion);
				}else{
					product.setStockCount(product.getStockCount()+item.getCount());
				}
				productMng.update(product);
				discussMng.deleteByorderItemId(item.getId());
			}
			//判断不是退款订单
			if(bean.getReturnOrder()==null){		 		
				//会员冻结的积分
				ShopMember member = bean.getMember();
				member.setFreezeScore(member.getFreezeScore()-bean.getScore());
				shopMemberMng.update(member);
				List<ShopScore> list = shopScoreMng.getlist(bean.getCode());
				for(ShopScore s:list){
					shopScoreMng.deleteById(s.getId());
				}
			}
		}
		//shopPaymentorderMng中不存在预售订单数据
		if(bean.getRefunded()==false&&bean.getShopPaymentorder()!=null){
			shopPaymentorderMng.deleteById(bean.getShopPaymentorder().getId());			
		}
		bean = dao.deleteById(id);
		return bean;
	}

	public Order[] deleteByIds(Long[] ids) {
		Order[] beans = new Order[ids.length];
		for (int i = 0, len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}
	
	//添加方法，根据订单状态获取所有订单
	public List<Order> getCountByStatus(Date startTime,Date endTime,Integer status){
		return dao.getCountByStatus(startTime,endTime,status);
	}
	
	public List<Order> getPaymentOrder(ShopPaymentorder shopPaymentorder){
		return dao.getPaymentOrder(shopPaymentorder);
	}
		
	public List<Order> getStatisticByYear(Integer year,Integer status){
		return dao.getStatisticByYear(year,status);
	}
	
	 public List<Order> getList1(Long[]memberId){
		List<Order> list= dao.getList1(memberId);
		return list;
	 }
	 
	 public List<Order> getlist(){
		 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		 Date newDate=new Date();
		 Date endDate=null;
		 Calendar date=Calendar.getInstance();
		 date.setTime(newDate);
		 date.set(Calendar.DATE, date.get(Calendar.DATE) - 1);
		 try {
			endDate = sdf.parse(sdf.format(date.getTime()));
	     } catch (java.text.ParseException e) {
			e.printStackTrace();
		 }
		 List<Order> list=dao.getlist(endDate);
		 return list;
	 }
	
	 public void abolishOrder(){
		 List<Order> orderList=getlist();
		 for(Order order:orderList){
			 //查过时间段把订单状态改为取消
			 order.setStatus(3);
			 //处理库存
			 for(OrderItem item:order.getItems()){
				 Product product=item.getProduct();
				 if(item.getProductFash()!=null){
					 ProductFashion fashion=item.getProductFash();
					 fashion.setStockCount(fashion.getStockCount()+item.getCount());
					 product.setStockCount(product.getStockCount()+item.getCount());
					 productFashionMng.update(fashion);
				 }else{
					 product.setStockCount(product.getStockCount()+item.getCount());
				 }
				 productMng.update(product);
			 }
			 //会员冻结的积分
			 ShopMember member=order.getMember();
			 member.setFreezeScore(member.getFreezeScore()-order.getScore());
			 shopMemberMng.update(member);
			 List<ShopScore> list=shopScoreMng.getlist(order.getCode());
			 for(ShopScore s:list){
				 shopScoreMng.deleteById(s.getId());
			 }
			 updateByUpdater(order);
		 }
	 }
	
	@Autowired
	private OrderDao dao;
	@Autowired
	private CartMng cartMng;
	@Autowired
	private StoreMng storeMng;
	@Autowired
	private ProductMng productMng;
	@Autowired
	private WebsiteMng websiteMng;
	@Autowired
	private ShippingMng shippingMng;
	@Autowired
	private ShipmentsMng shipmentMng;
	@Autowired
	private CartItemMng cartItemMng;
	@Autowired
	private ShopScoreMng shopScoreMng;
	@Autowired
	private ShopMemberMng shopMemberMng;
	@Autowired
	private ProductFashionMng productFashionMng;
	@Autowired
	private DiscussMng discussMng;
	@Autowired
	private ShopPaymentorderMng shopPaymentorderMng;
	@Autowired
	private MemberCouponMng memberCouponMng;
	@Autowired
	private OrderReturnMng orderReturnMng;
}